﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NPMonitor.Interfaces;
using NPMonitor.DataModel;

namespace NPMonitor.Utility
{
    public abstract class JobBase : MarshalByRefObject, IJob, IDisposable
    {
        private bool disposed = false;

        public abstract JobExecutionResult Execute(string jobData, Guid historyUniqueId);

        public void Dispose()
        {
            Dispose(true);

            // Take yourself off the Finalization queue 
            // to prevent finalization code for this object
            // from executing a second time.
            // 由于用户是显示调用，所以资源释放不再由GC来完成
            GC.SuppressFinalize(this);
        }

        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                // TODO Dispose
            }
            disposed = true;
        }
    }
}
